#$Source: Volumes://MATEOR/prlserverapi/prlserverapi-gui.rc/sacalc.pm$
#$Date: June 18, 2012$
#$Revision: 0.01-0a$

use strict;
package sacalc;

my $content;

sub page{
  my($r) = @_;
  my($cgi) = $r->{uri}->{params};
  if($cgi->{'cost'} > 0 and $cgi->{'num'} > 0){
    my $cost = $cgi->{'cost'}/$cgi->{'num'};
    $content = <<EOF;
      <h1>Result</h1>
      Cost per eater: $cost<br />
      <a href="JavaScript:xmlhttpPost('/sampleapp.initial', 'sampleapp');">Again!</a>
EOF
  } else {
    $content = <<EOF;
Please go back and enter values above 0!<br />
<a href="JavaScript:xmlhttpPost('/sampleapp.initial', 'sampleapp');">Back!</a>
EOF
  }
  return $content;
}

1;
